Skip to content

Make Shelly 2PM cover tilt configurable#12497

Merged
Koenkk merged 1 commit into
Koenkk:masterfrom
MaxRink:shelly-cover-tilt-option
Jun 23, 2026
Merged

Make Shelly 2PM cover tilt configurable#12497
Koenkk merged 1 commit into
Koenkk:masterfrom
MaxRink:shelly-cover-tilt-option

Conversation

@MaxRink

@MaxRink MaxRink commented Jun 21, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Make Shelly 2PM Gen4 cover tilt/slat exposure dynamic instead of always exposing tilt.
  • Read Cover.GetConfig over the Shelly RPC cluster during configure and persist slat.enable into device metadata.
  • Keep a cover_tilt_enabled device option with auto, true, and false for manual override when RPC config cannot be read.
  • Handle Cover.GetConfig responses wrapped in result, wrapped in params, or returned directly.

Scope

This PR is intentionally cover-only. The related behavior from the original combined branch was split into separate PRs:

Review feedback addressed

  • auto is no longer equivalent to false: after configure it follows the device-reported slat.enable value, while true and false remain explicit overrides.
  • Overwrites stale persisted tilt metadata when the device reports slat.enable: false.
  • Keeps tilt controls hidden for Shelly 2PM cover variants without slat control, while still allowing a manual override when RPC config cannot be read.

Validation

  • PATH="/opt/homebrew/opt/node@24/bin:$PATH" npx pnpm@10.18.3 exec vitest run test/shelly.test.ts --config ./test/vitest.config.mts (8 tests)
  • PATH="/opt/homebrew/opt/node@24/bin:$PATH" npx pnpm@10.18.3 exec biome check --error-on-warnings src/devices/shelly.ts test/shelly.test.ts
  • PATH="/opt/homebrew/opt/node@24/bin:$PATH" npx pnpm@10.18.3 run build
  • git diff --check

Live validation

  • Verified on my Home Assistant instance that the Shelly 2PM Gen4 cover devices expose the cover_tilt_enabled option.
  • Verified on my Home Assistant instance that cover tilt/slat controls remain hidden when Shelly slat control is disabled.
  • Verified on my Home Assistant instance with a combined local override before this split; this PR now contains only the cover part of that validated behavior.

@andrei-lazarov

Copy link
Copy Markdown
Contributor

This is cool. But I don't think it should be specific to Shelly, and disabled by default.
Also why include auto if it's the same as false?

@MaxRink

MaxRink commented Jun 21, 2026

Copy link
Copy Markdown
Contributor Author

im currentlky still trying to find a way to read the state that is actually set via the WbUI/App on the shelly to make auto useful
image
But the general idea for this flag is to inherit whatever got confed during shelly setup

Edit: im currently looking at https://shelly-api-docs.shelly.cloud/gen2/Integrations/Zigbee/RPCCluster and i think it should be possible

@MaxRink MaxRink force-pushed the shelly-cover-tilt-option branch 2 times, most recently from a391be7 to 2b87093 Compare June 22, 2026 10:12
@MaxRink MaxRink changed the title Make Shelly 2PM cover tilt opt-in Use Shelly RPC for cover tilt and Presence zones Jun 22, 2026
@MaxRink MaxRink force-pushed the shelly-cover-tilt-option branch from 2b87093 to 0186739 Compare June 22, 2026 10:27
@MaxRink MaxRink changed the title Use Shelly RPC for cover tilt and Presence zones Make Shelly 2PM cover tilt configurable Jun 22, 2026
@Koenkk

Koenkk commented Jun 22, 2026

Copy link
Copy Markdown
Owner

Edit: im currently looking at https://shelly-api-docs.shelly.cloud/gen2/Integrations/Zigbee/RPCCluster and i think it should be possible

Could we go for this solution directly?

@MaxRink

MaxRink commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Ive already implemented it, just havent updated the MR description yet

@MaxRink MaxRink force-pushed the shelly-cover-tilt-option branch from 0186739 to b99c20f Compare June 22, 2026 19:44
@MaxRink

MaxRink commented Jun 22, 2026

Copy link
Copy Markdown
Contributor Author

Updated the implementation and PR body around this.

auto now reads the Shelly-side setting directly via the RPC cluster (Cover.GetConfig) during configure and persists slat.enable into device metadata. So auto means “follow the device config from the Shelly Web UI/app”, while true/false remain explicit Zigbee2MQTT overrides for failed RPC reads or manual testing.

I kept the option Shelly-specific because the only device-side source of truth here is Shelly RPC; the generic cover path is unchanged.

@MaxRink MaxRink force-pushed the shelly-cover-tilt-option branch from e8cc761 to 755469a Compare June 23, 2026 01:19
@MaxRink MaxRink marked this pull request as draft June 23, 2026 10:45
@MaxRink MaxRink marked this pull request as ready for review June 23, 2026 10:50
@MaxRink MaxRink marked this pull request as draft June 23, 2026 11:18
@MaxRink MaxRink force-pushed the shelly-cover-tilt-option branch from 99a6d22 to 8ef9789 Compare June 23, 2026 11:18
@MaxRink MaxRink force-pushed the shelly-cover-tilt-option branch from 8ef9789 to 3ed5fa2 Compare June 23, 2026 11:33
@MaxRink MaxRink marked this pull request as ready for review June 23, 2026 11:35
@MaxRink MaxRink marked this pull request as draft June 23, 2026 12:09
@MaxRink MaxRink marked this pull request as ready for review June 23, 2026 13:48
@Koenkk Koenkk merged commit b66ea3f into Koenkk:master Jun 23, 2026
5 checks passed
@Koenkk

Koenkk commented Jun 23, 2026

Copy link
Copy Markdown
Owner

thanks!

@SebiGo

SebiGo commented Jul 4, 2026

Copy link
Copy Markdown
Contributor

Thanks a lot for adding this, @MaxRink — being able to hide tilt controls for covers without slats is a nice improvement!

Just want to flag one thing for other users upgrading: on my existing Shelly 2PM cover with real venetian-blind hardware, tilt was always exposed before, and after this update it disappeared from Home Assistant. The auto detection via Cover.GetConfig apparently didn't pick up slat.enable correctly in my case.

For anyone else running into this: you can fix it via the Z2M UI under the device's Settings (specific) tab → Cover tilt enabled, and set it to true:

Screenshot from 2026-07-04 10-02-19

To be clear, this is a one-time migration issue for existing setups, not an ongoing problem — going forward, new pairings should detect this correctly from the start.

@ebeng

ebeng commented Jul 6, 2026

Copy link
Copy Markdown

Thanks a lot for adding this, @MaxRink — being able to hide tilt controls for covers without slats is a nice improvement!

Just want to flag one thing for other users upgrading: on my existing Shelly 2PM cover with real venetian-blind hardware, tilt was always exposed before, and after this update it disappeared from Home Assistant. The auto detection via Cover.GetConfig apparently didn't pick up slat.enable correctly in my case.

For anyone else running into this: you can fix it via the Z2M UI under the device's Settings (specific) tab → Cover tilt enabled, and set it to true:

Screenshot from 2026-07-04 10-02-19 To be clear, this is a one-time migration issue for existing setups, not an ongoing problem — going forward, new pairings should detect this correctly from the start.

Indeed!
All of my automations for the blinds/shutters/covers stopped working. I had to one by one enable them back again :)
Thank you! I wouldn't have found it otherwise...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants